package com.wuzheng.wisgo.sanitation.cloud.service.plan.impl;

import com.wuzheng.wisgo.sanitation.cloud.model.plan.pojo.JobPlanDetailShiftDTO;
import com.wuzheng.wisgo.sanitation.cloud.repository.entity.jobshift.BaJobShift;
import com.wuzheng.wisgo.sanitation.cloud.repository.entity.plan.JobPlanShift;
import com.wuzheng.wisgo.sanitation.cloud.service.jobshift.BaJobShiftService;
import com.wuzheng.wisgo.sanitation.cloud.service.plan.JobPlanShiftService;
import com.wuzheng.wisgo.sanitation.framework.base.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author：hoipang
 * @date：Created in 2019-12-19
 * @description：道路作业计划与班次关联服务实现类
 * @modified By：
 * @version: 1.0
 */
@Service
public class JobPlanShiftServiceImpl extends BaseServiceImpl<JobPlanShift> implements JobPlanShiftService {
    @Resource
    BaJobShiftService jobShiftService;

    @Override
    public List<JobPlanDetailShiftDTO> listDetailShiftDTOs(String jobTypeCode) {
        List<BaJobShift> shiftList = jobShiftService.list(jobTypeCode);
        List<JobPlanDetailShiftDTO> list = new ArrayList<>();
        shiftList.forEach(m -> {
            JobPlanDetailShiftDTO item = new JobPlanDetailShiftDTO();
            item.setId(m.getId());
            item.setShiftName(m.getShiftName());
            item.setStartWorkTime(m.getStartWorkTime());
            item.setOffWorkTime(m.getOffWorkTime());
            list.add(item);
        });
        return list;
    }
}
